﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class User_ProductCataloges : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {

               string madm = Request.QueryString["MaDM"].ToString();
                
                SanPhamCtr SanPhamCtr = new SanPhamCtr();
                DataTable dataTable = new DataTable();
                dataTable = SanPhamCtr.GetSanPhamTheoMaDanhMuc(madm);
                
                CollectionPager1.PageSize = 9;// Số items muốn hiển thị trên 1 trang.
                CollectionPager1.DataSource = dataTable.DefaultView;
                CollectionPager1.BindToControl = dlDanhMuc;
                dlDanhMuc.DataSource = CollectionPager1.DataSourcePaged;
            }
            catch
            {
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert",
                // "alert('URL không hợp lệ!');", true);
                Response.Redirect("NotFound.aspx");
            }

        }
    }
}